package org.example.demo1startjava17.designPattern.cStructuralPatterns.c1DecoratorPattern.demo1;

import org.springframework.stereotype.Component;

@Component
public class PercentageDiscountDecorator extends OrderServiceDecorator {

    @Override
    public double applyDiscount(double orderTotal) {
        // 折扣率
        double discountRate = 0.2;
        double discount = orderTotal * discountRate;
        return super.applyDiscount(orderTotal - discount);
    }
}
